#ifndef GEOMETRIES_WIDGET_H
#define GEOMETRIES_WIDGET_H

#include "common/parameters.h"
#include "mvc/model/configuration.h"
#include "common/types.h"
#include "common/ITexture_image.h"

#include <QWidget>
#include <QTreeWidgetItem>
#include <QMap>

class Opengl_widget;

namespace Ui {
    class Geometries_widget;
}

class Geometries_widget : public QWidget
{
    Q_OBJECT

public:
    explicit Geometries_widget(QWidget *parent = 0);
    ~Geometries_widget();
    void create_configuration(int id_configuration, Parameters *values);
    void draw_configuration(const Configuration *config, bool draw_sim, int step);
    void set_configuration_type(int type);
    int add_texture(ITexture_image *texture);
    bool getClosed();
    void retranslateUi();

signals:
    void s_draw_configuration(int configuration);
    void s_simulate_configuration(int configuration);

public slots:
    void show_configuration(QTreeWidgetItem *item);
    void simulate();
    void rrotate();
    void lrotate();
    void urotate();
    void drotate();
    void zin();
    void zout();
    void rmove();
    void lmove();
    void umove();
    void dmove();
    void reset_camera();
    void uavtex();
    void simtex();
    void perspective();
    void ortho();

private:
    void add_item(QTreeWidgetItem *parent, int pos, const QString item_name,
                  QMap<QString, float> items);

private:
    Ui::Geometries_widget *ui;
    int drawed_configuration; // the current drawed configuration
    int configuration_type; // the type of the configuration
    bool closed; // indicates if the widget is closed or not
};

#endif // GEOMETRIES_WIDGET_H
